import React, { useContext, useMemo } from 'react';
import MyIcon from '@/components/MyIcon';
import { DetailInfoBottomBtnView } from './DetailInfoBottomBtnView';
import { ChangeControllerContext } from '../common/useOAContext';

export const DetailInfoTopViewOA: React.FC<any> = ({ position, locationProps }) => {
  /** 引入上下文 */
  const { styleFixCls, infoObj } = useContext(ChangeControllerContext);

  /** 返回头部内容申请 */
  const renderTopTitleText = useMemo(() => {
    {
      return `${infoObj?.ownerName || '--'}的资产调拨申请`;
    }
  }, [infoObj]);

  return (
    <div className={`${styleFixCls}infoViewOA-titleBox`}>
      <div className={`${styleFixCls}infoViewOA-titleBox-textValue`}>
        {infoObj?.ownerName && (
          <>
            <MyIcon type="icon-dian" />
            {renderTopTitleText}
          </>
        )}
      </div>
      <DetailInfoBottomBtnView position="top" locationProps={locationProps} />
    </div>
  );
};
